home *** CD-ROM | disk | FTP | other *** search
-
- package sub_arctic.lib;
-
- import sub_arctic.output.drawable;
- import java.awt.Rectangle;
-
- /**
- * Traversal transformer (see base_interactor.traverse_and_collect) that takes
- * a sem_draw_context and transforms it into a child object's coordinates.
- * This involves modifying the translation on the drawable surface of the
- * sem_draw_context, so that it matches the local coordinates of the child
- * object.
- *
- * @see sub_arctic.lib.base_interactor#traverse_and_collect
- * @see sub_arctic.lib.sem_draw_context
- * @author Scott Hudson
- */
- public class sem_draw_to_child implements traversal_xform {
- /** Perform the transformation.
- *
- * @param parent_parameters a sem_draw_context object set up in parent coords
- * @param child_obj the child object
- * @return a sem_draw_context object set up in child coordinates
- */
- public Object xform(
- Object parent_parameters,
- interactor child_obj,
- int child_index)
- {
- sem_draw_context parent_context, result;
-
- if (!(parent_parameters instanceof sem_draw_context))
- throw new sub_arctic_error(
- "sem_draw_context object was expected, but not found");
-
- /* extract the parent context */
- parent_context = (sem_draw_context)parent_parameters;
-
- /* copy the context and apply transformation to get to child coords */
- result = new sem_draw_context(parent_context);
- result.surface.translate(child_obj.x(), child_obj.y());
-
- return result;
- }
-
- //had:
- //* @exception sub_arctic.exception.bad_value thrown if the parent_parameters
- //* parameter is not a sem_draw_context.
- };
- /*=========================== COPYRIGHT NOTICE ===========================
-
- This file is part of the subArctic user interface toolkit.
-
- Copyright (c) 1996 Scott Hudson and Ian Smith
- All rights reserved.
-
- The subArctic system is freely available for most uses under the terms
- and conditions described in
- http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html
- and appearing in full in the lib/interactor.java source file.
-
- The current release and additional information about this software can be
- found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
-
- ========================================================================*/
-